<?php
namespace app\api\service;
use think\Controller;
use Des3\DES3;
use think\Db;

class Product extends Controller {

    // 获取产品数量
    static public function goods_num($param) {

        $des = new DES3();
        $user_name = $des->encrypt('我们的征途是星辰大海！');
        $password = $des->encrypt('lslt012520');

        return ['user_name' => $user_name, 'password' => $password];
    }

    //
    static public function stock_removal_status($param) {
        $des = new DES3();
        $user_name = $des->decrypt('/zLTqly6F3LXUTP/FJLjuvMO66qo/dqUqmCCPYukGMIFE3aLeZHRsw==');
        $password = $des->decrypt('ojJo2ev5n4OEcqzZJKc0TA==');
        return ['user_name' => $user_name, 'password' => $password];
    }

    //
    static public function goods_test($param) {

        try{
            $integrals = Db::table('mob_region')->paginate(25);
            return ['data'=>$integrals, 'code'=>200, 'msg'=> 'SUCCESS'];
        } catch (\Exception $e) {
            // 回滚事务
            Db::rollback();
            return ['data'=>'','code'=>0,'msg'=> $e->getMessage()];
        }
    }
}
